#!/usr/bin/env bash
# 本地安装qemu脚本，用于本地开发调试qemu

set -e
pip3 config set global.break-system-packages true
python3 build.py
echo "------------Build qemu successfully--------------"

if dpkg-query -W -f='${status}' openubmc-qemu 2>/dev/null |grep -q "ok installed"; then
	apt purge -y openubmc-qemu
fi
echo "-----------Uninstall bingo successfully------------"

deb_pkg=$(find output/ -type f -name "*.deb")
echo $deb_pkg
apt install -y ./"$deb_pkg"
echo "------------Install bingo successfully------------"